<template>
  <div class="page-census page-setting">
    <el-container :style="{ height: mainH + 'px' }">
      <el-aside class="setting-nav-wrap" width="200px">
        <ul class="setting-nav">
          <router-link
            tag="li"
            to="/setting"
            :class="{ active: $route.path == '/setting' }"
            v-if="hasPermission('006001')"
          >
            <i class="iconfont icon-user"></i> 部门与账号
          </router-link>
          <router-link
            tag="li"
            to="/settingArea"
            :class="{ active: $route.path == '/settingArea' }"
            v-if="hasPermission('006002')"
          >
            <i class="iconfont icon-loc"></i> 行政区域设置
          </router-link>
          <router-link
            tag="li"
            to="/settingHome"
            :class="{ active: $route.path == '/settingHome' }"
            v-if="hasPermission('006004')"
          >
            <i class="iconfont icon-home"></i> 首页设置
          </router-link>
          <router-link
            tag="li"
            to="/settingRole"
            :class="{ active: $route.path == '/settingRole' }"
            v-if="hasPermission('006003')"
          >
            <i class="iconfont icon-user"></i> 角色管理
          </router-link>
          <router-link
            tag="li"
            to="/settingHandle"
            :class="{ active: $route.path == '/settingHandle' }"
            v-if="hasPermission('006005')"
          >
            <i class="iconfont icon-warn"></i> 处置管理
          </router-link>
          <router-link
            tag="li"
            to="/settingIOT"
            :class="{ active: $route.path == '/settingIOT' }"
            v-if="hasPermission('006006')"
          >
            <i class="iconfont icon-BigScreen"></i> 大屏设置
          </router-link>
          <router-link
            tag="li"
            to="/settingUpdateContent"
            :class="{ active: $route.path == '/settingUpdateContent' }"
            v-if="isAdmin"
          >
            <i class="iconfont icon-update-records"></i>
            更新记录
          </router-link>
        </ul>
      </el-aside>
      <el-main class="setting-main">
        <keep-alive>
          <router-view :winH="winH" v-if="$route.meta.keepAlive"></router-view>
        </keep-alive>
        <router-view :winH="winH" v-if="!$route.meta.keepAlive"></router-view>
      </el-main>
    </el-container>
  </div>
</template>
<script>
import { mapState } from "vuex";
export default {
  name: "setting",
  components: {},
  props: {
    winH: {
      type: Number,
      default: 500
    }
  },
  data() {
    return {};
  },
  computed: {
    mainH() {
      return this.winH - 180;
    },
    ...mapState(["siteInfos"]),
    isAdmin() {
      return this.siteInfos && this.siteInfos.userType == 1;
    }
  },
  watch: {},
  methods: {},
  created() {},
  activated() {},
  mounted() {}
};
</script>
